<html>
<head>
<title>errno</title>
<body bgcolor=#ffffff>
<h2 align=center>errno</h2>
<h4 align=center>OS/161 Reference Manual</h4>

<h3>Name</h3>
errno - error code reporting

<h3>Library</h3>
Standard C Library (libc, -lc)

<h3>Synopsis</h3>
#include &lt;errno.h&gt;<br>
<br>
extern int errno;

<h3>Description</h3>

When system calls, and sometimes other functions, fail, a code
representing or describing the error condition is placed in the global
variable errno.
<p>

errno is always left unchanged by successful operations.
<p>

errno may be a macro. In a multithreaded process it is almost
invariably a macro. However, it is always an lvalue, that is, it may
be assigned to.
<p>

Each numeric code has a symbolic name and a textual expansion. The
symbolic names are used in source code; the textual expansions are
printed out when errors are reported to a user.
<p>

The textual expansions can be retrieved with 
<A HREF=../libc/strerror.html>strerror</A> or printed with 
<A HREF=../libc/err.html>err</A> or <A HREF=../libc/warn.html>warn</A>. 
<p>

<h3>Symbolic names</h3>

The following symbolic errors are defined in the OS/161 base system.
You may add more at your pleasure; but be sure to read the notes in 
the file kern/errno.h that defines them.

<blockquote>
<table width=90%>
<td width=10%>&nbsp;</td><td>&nbsp;</td></tr>

<tr><td valign=top>EINVAL</td>
<td>Invalid argument: an argument passed to a command or system call
	was badly formed, invalid, or nonsensical.</td></tr>

<tr><td valign=top>EFAULT</td>

<td>Bad memory reference: a pointer passed as an argument was not
	valid.</td></tr>

<tr><td valign=top>ENAMETOOLONG</td>

<td>String too long: a string passed as an argument was too long to
	process.</td></tr>

<tr><td valign=top>ENOMEM</td>

<td>Out of memory: a memory allocation failed. This normally means
	that a process has used up all the memory available to it
	(either because of limits or because it has used up all the
	memory available to the system.) It may also mean that memory
	allocation within the kernel has failed.</td></tr>

<tr><td valign=top>EIO</td>
<td>Input/output error: a hardware error occured on a device. Media
	errors on disks fall into this category.</td></tr>

<tr><td valign=top>ENOENT</td>
<td>No such file or directory: the requested filesystem object
	does/did not exist.</td></tr>

<tr><td valign=top>ENOTDIR</td>
<td>Not a directory: a directory was expected and a non-directory
	filesystem object was found.</td></tr>

<tr><td valign=top>EISDIR</td>
<td>Is a directory: a non-directory was expected and a directory was
	found.</td></tr>

<tr><td valign=top>EEXIST</td>
<td>File exists: a filesystem object that was expected not to exist
	did in fact already exist.</td></tr>

<tr><td valign=top>EXDEV</td>
<td>Cross-device link: an attempt was made to instruct one filesystem
	to handle files on another filesystem.</td></tr>

<tr><td valign=top>EAGAIN</td>
<td>Try again later: some resource is temporarily
	unavailable.</td></tr>

<tr><td valign=top>ESPIPE</td>
<td>Illegal seek: a seek operation was attempted on a sequential
	object where seeking makes no sense, like a
	terminal.</td></tr>

<tr><td valign=top>EUNIMP</td>
<td>Unimplemented feature: functionality not yet implemented would
	have been needed to perform the requested operation.</td></tr>

<tr><td valign=top>ENXIO</td>
<td>Device not available: the requested device exists but is not
	available (is not mounted, is off, etc.)</td></tr>

<tr><td valign=top>ENODEV</td>
<td>No such device: the requested device does not exist.</td></tr>

<tr><td valign=top>EBUSY</td>
<td>Device busy: the requested object cannot be used (or, perhaps,
	released) because something else is using it.</td></tr>

<tr><td valign=top>EIOCTL</td>
<td>Invalid or inappropriate ioctl: an operation requested via the 
	<A HREF=../syscall/ioctl.html>ioctl</A> system call was not
	defined or could not be performed on the indicated
	object.</td></tr>

<tr><td valign=top>ENOTEMPTY</td>
<td>Directory not empty: a directory must be empty of everything
	(except . and ..) before it may be removed.</td></tr>

<tr><td valign=top>ERANGE</td>
<td>Result too large: the result of an operation did not fit in the
	space provided.</td></tr>

<tr><td valign=top>ENOSPC</td>
<td>No space left on device: a filesystem is full.</td></tr>

<tr><td valign=top>EMFILE</td>
<td>Too many open files: the process file table is full, so the
	process cannot open more files.</td></tr>

<tr><td valign=top>ENFILE</td>
<td>Too many open files in system: a system-wide limit of some sort,
	if any exists, on the number of open files has been
	reached.</td></tr>

<tr><td valign=top>ENOSYS</td>
<td>No such system call: the call made was not defined, or perhaps not
	yet implemented.</td></tr>

<tr><td valign=top>ENOEXEC</td>
<td>File is not executable: an <A HREF=../syscalls/execv.html>execv</A>
	operation was attempted but the kernel was unable to run the
	requested program.</td></tr>

<tr><td valign=top>E2BIG</td>
<td>Argument list too long: the space taken up by the argv[] strings
	passed to a newly started program is larger than the system
	allows.</td></tr>

<tr><td valign=top>EBADF</td>
<td>Bad file number: a file operation was requested on an illegal file
	handle, or a file handle that was not open. Or, a write
	operation was attempted on a file handle that was open only
	for read or vice-versa.</td></tr>

</table>
</blockquote>

</body>
</html>
